// let BASE_URL = 'http://172.20.3.241:8088/'
// let BASE_URL = 'http://172.20.49.105:8088/'

let BASE_URL

const request = options => {
  const { url, method, data, header } = options
  return new Promise((resolve, reject) => {
    uni.request({
      url: BASE_URL + url,
      method,
      data,
      header,
      success: res => {
        if (res.statusCode === 200) {
          resolve(res.data)
        } else {
          reject(res)
        }
      },
      fail: err => {
        reject(err)
      }
    })
  })
}

export default request
